#include "ofxIRCPrivMsg.h"
#include <iostream>

ofxIRCPrivMsg::ofxIRCPrivMsg(
	int iType
	,std::vector<std::string>oTokens
	,std::vector<std::string>oParams
):ofxIRCMessageType(iType,oTokens, oParams) {
	parse();
}

void ofxIRCPrivMsg::parse() {
	if (tokens.size() < 2) return;
	if(tokens.at(1).find_first_of("!") != std::string::npos) {
		nick = tokens.at(1).substr(0, tokens.at(1).find_first_of("!"));
	}
}

std::string ofxIRCPrivMsg::getNick() {
	return nick;
}

std::string ofxIRCPrivMsg::getMessage() {
	// @todo we need to handle messages with ":" in it as well...
	if(tokens.size() < 3) { return ""; }
	return tokens.at(2);

}
